package com.opgea.tutor.web.dto;

import com.opgea.tutor.domain.entities.Person;
import com.opgea.tutor.domain.entities.Student;
import com.opgea.tutor.domain.interfaces.Marshallable;

public class StudentDTO extends Person implements Marshallable<Student> {

    /**
     * 
     */
    private static final long serialVersionUID = -6638131371591558008L;
    private long id;
    private long loginIdPrimaryKey;

    private String schoolName;
    private String standard;
    private String educationMedium;
    private String description;

    public long getId() {
	return id;
    }

    public void setId(long id) {
	this.id = id;
    }

    public long getLoginIdPrimaryKey() {
	return loginIdPrimaryKey;
    }

    public void setLoginIdPrimaryKey(long loginIdPrimaryKey) {
	this.loginIdPrimaryKey = loginIdPrimaryKey;
    }

    public String getSchoolName() {
	return schoolName;
    }

    public void setSchoolName(String schoolName) {
	this.schoolName = schoolName;
    }

    public String getStandard() {
	return standard;
    }

    public void setStandard(String standard) {
	this.standard = standard;
    }

    public String getEducationMedium() {
	return educationMedium;
    }

    public void setEducationMedium(String educationMedium) {
	this.educationMedium = educationMedium;
    }

    public String getDescription() {
	return description;
    }

    public void setDescription(String description) {
	this.description = description;
    }

    @Override
    public void marshall(Student student) {
	if (student != null && student.getId() > 0) {
	    setId(student.getId());
	    setFirstName(student.getFirstName());
	    setMiddleName(student.getMiddleName());
	    setLastName(student.getLastName());
	    setTitle(student.getTitle());
	    setSex(student.getSex());
	    setDateOfBirth(student.getDateOfBirth());

	    this.description = student.getDescription();
	    this.educationMedium = student.getEducationMedium();
	    this.schoolName = student.getSchoolName();
	    this.standard = student.getStandard();
	}
    }

    @Override
    public Student unmarshall(Student student) {
	if (this.getId() > 0 && student != null) {
	    student.setId(this.getId());
	    student.setFirstName(this.getFirstName());
	    student.setMiddleName(this.getMiddleName());
	    student.setLastName(this.getLastName());
	    student.setTitle(this.getTitle());
	    student.setSex(this.getSex());
	    student.setDateOfBirth(this.getDateOfBirth());
	    student.setDescription(this.getDescription());
	    student.setEducationMedium(this.educationMedium);
	    student.setSchoolName(this.schoolName);
	    student.setStandard(this.getStandard());
	}
	return student;
    }

}
